/* eslint-disable */
import Vue from "vue";
import Router from "vue-router";

import demoPageRouter from "@/views/demoPage/routes";
import iframeRouter from "@/views/iframe/routes";
import authRouter from "@/common/auth/routes";

import HomeLayoutRouter from "@/views/Home/routes";//上中下布局
/* Layout */
import Layout from '@/views/layout/Layout'//侧边栏布局
Vue.use(Router);

export const constantRouterMap = [
  {
    path: '',
    component: Layout,
    redirect: '/dashboard',
    children: [{
      path: 'dashboard',
      component: () => import('@/views/dashboard/index'),
      name: 'Dashboard',
      meta: { title: 'dashboard', icon: 'el-icon-menu', noCache: true, affix: true}
    }]
  },
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: () => import('@/common/redirect/index')
      }
    ]
  },
  { path: "/404", name: "404", meta: { title: "404" , icon:"el-icon-menu"}, component: () => import("@/common/errorPage/404.vue") },
  { path: "/login", name: "login", meta: { title: "登录" , icon:"el-icon-menu"}, component: () => import("@/common/login/index.vue") },
  //各页面路由 start
  // ...HomeLayoutRouter,
  // ...authRouter,
  ...demoPageRouter,
  // ...iframeRouter,
  //各页面路由 end
  { path: '*', redirect: '/404' }
];

const createRouter = () => new Router({
  routes: constantRouterMap
});

const router = createRouter()

export const asyncRouterMap = [{
  path: '/example',
  component: Layout,
  redirect: '/example/asyncDemo',
  name: 'example',
  meta: {
    title: 'example',
    icon: 'example'
  },
  children: [
  {
    path: 'asyncDemo',
    name: 'asyncDemo',
    component: () => import('@/views/demoPage/children/eleTable.vue'),
    meta: {
      title: 'asyncDemo',
      icon: 'el-icon-menu'
    }
  }
  ]
}]

export default router;
